package com.trip_memories;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import blogic.Operations;

public class SavePicture extends Activity {

	private byte[] imagedata;
	

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);		
		setContentView(R.layout.activity_save_picture);

		getDatas();

		Bitmap img = Operations.convertFromBytesInBitmap(this, imagedata, 0);

		ImageView screen = (ImageView)findViewById(R.id.showPicture);

		screen.setImageBitmap(img);
	}
	
	public boolean onSave(View v){
		
		Intent intent = new Intent(this, SavePictureInDb.class);
		
		intent.putExtra("bytes", imagedata);
		
		startActivity(intent);
		finish();
		return true;
	}


	public boolean onCancel(View v){
		finish();
		return true;
	}
	
	private void getDatas() {
		try {
			imagedata = getIntent().getExtras().getByteArray("bytes");
			
		} catch (Exception e) {

		}
	}
}
